var example = [8, 94, 15, 88, 55, 76, 21, 39];

function bubbleSort(arr) {
  console.time('选择排序耗时')
  for (let j = 0; j < arr.length; j++) {
    for (let i = 0; i < arr.length - j; i++) {
      if (arr[i] < arr[i + 1]) {
        temp = arr[i]
        arr[i] = arr[i + 1]
        arr[i + 1] = temp
      }
    }
  }
  console.timeEnd('选择排序耗时');
  console.log(arr)
}

bubbleSort(example)